import dash
from dash import dcc, html

app = dash.Dash(__name__)

app.layout = html.Div(
    children=[
        html.H1(children="Dash 图表_下拉框_示例"),
        dcc.Graph(
            id="example_graph",
            figure={
                "data": [
                    {"x": [1, 2, 3], "y": [4, 1, 2], "type": "bar", "name": "ShenZhen"},
                    {"x": [1, 2, 3], "y": [2, 4, 5], "type": "bar", "name": "Beijing"},
                ],
                "layout": {"title": "Dash Data Visualization 数据可视化示例"},
            },
        ),
        dcc.Dropdown(
            id="example_dropdown",
            options=[
                {"label": "选项1", "value": "1"},
                {"label": "选项2", "value": "2"},
                {"label": "选项3", "value": "4"},
            ],
            value="1",
        ),
    ]
)

if __name__ == "__main__":
    app.run(debug=True, port=8090)
